<template>
  <h1>{{ msg }}</h1>

  <p>
    <a href="https://vitejs.dev/guide/features.html" target="_blank">
      Vite Documentation
    </a>
    |
    <a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
  </p>

  <button type="button" @click="state.count++">
    count is: {{ state.count }}
  </button>
  <p>
    Edit
    <code>components/HelloWorld.vue</code> to test hot module replacement.
  </p>

  <h1>{{ state.info }}</h1>
</template>

<script setup>
import { defineProps, reactive } from 'vue'
import axios from 'axios';
defineProps({
  msg: String
})

const state = reactive({ count: 0,
                        info: "发起请求" })

axios
      .get('http://localhost:8080/address')
      .then(response => (state.info = response.data))
      .catch(function (error) { // 请求失败处理
        state.info = 'error heppen';
    });
  
</script>

<style scoped>
a {
  color: #42b983;
}
</style>
